/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 晓星航
 * Date: 2023-01-05
 * Time: 12:25
 */

public class TestDemo {
    private static final String name = "bit";
    private static final String password = "123";
    public static void login(String name,String password) {
        if(!TestDemo.name.equals(name)) {
            System.out.println("用户名错误");
        }
        if(!TestDemo.name.equals(password)) {
            System.out.println("password错误");
        }
    }

    public static void main(String[] args) {
        int i = 0;
        while(i < 10) {
            try {
                if (i < 10) {
                    throw new Exception();
                }
            } catch (Exception e) {
                System.out.println("尝试连接网络第" + i + "次......");
                e.printStackTrace();
                i++;
            }
        }
        System.out.println("终于有网了，程序继续执行");
    }
    public static void mai2(String[] args) {
        try {
            throw new Exception("我抛出异常了");
        }catch (Exception e) {
            e.printStackTrace();
        }finally {
            System.out.println("finally执行了！");
        }
    }
    public static void main1(String[] args) {
        login("bit","123");
    }
}
